<?

function include_js($script, $type='ext')
{
   $script = preg_replace('/[^a-z\-\_0-9]/i', '', $script);
   
   $jd = _root._jsdir.$script.'.js';

   if (!is_file($jd)) return '<!-- can`t load script `'.$jd.'`! -->\n';
   
   if($type == 'int')
   {
      $src = readf($jd);
      
      return "\n<script>".str_replace("\n", ' ', $src)."</script>\n";
   }
   
   elseif($type == 'ext') return "<script src='"._basedomain._jsdir.$script.".js' ></script>\n";
}


function get_template($tplname)
{
   $tplname = preg_replace('/[^a-z0-9\-\_\.]/i', '', $tplname);
   
   $tpl = readf(_tpldir.$tplname);
   
   return $tpl;
}

function get_tpl($tplname)
{
   return get_template($tplname);
}

?>
